/**
 * 
 */
package home.yadong.email;

import java.io.IOException;
import java.util.Properties;

import javax.mail.Session;

/**
 * @author yadongMacPro
 * create base class for EmailSender and EmailReceiver
 */
public class ImapEmailBase {
	protected Session session;
	private String user;
	private String password;
	private String incomingHost;
	private String outgoingHost;
	
	public ImapEmailBase(String propertyFile) {
		Properties prop = new Properties();
		try {
			//pull properties file from classpath;
			prop.load(getClass().getClassLoader().getResourceAsStream(propertyFile));
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} 
		this.session=Session.getDefaultInstance(prop);
		this.user=prop.getProperty("user");
		this.password=prop.getProperty("password");
		this.incomingHost=prop.getProperty("incomingHost");
	}

	public Session getSession() {
		return session;
	}

	public void setSession(Session session) {
		this.session = session;
	}

	public String getUser() {
		return user;
	}

	public void setUser(String user) {
		this.user = user;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getIncomingHost() {
		return incomingHost;
	}

	public void setIncomingHost(String incomingHost) {
		this.incomingHost = incomingHost;
	}

	public String getOutgoingHost() {
		return outgoingHost;
	}

	public void setOutgoingHost(String outgoingHost) {
		this.outgoingHost = outgoingHost;
	}
	
}
